package com.lorenzogao.customview



import android.content.Intent

import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

import androidx.annotation.RequiresApi

import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.lorenzogao.customview.adapter.MainAdapter
import com.lorenzogao.customviewexample.R

import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {


    private val mData = mutableListOf(
        "QQ步数", "字体颜色变色", "ViewPager字体颜色变色", "圆形进度条"
        , "58同城数据加载", "RatingBar星级", "字母索引列表"



    )


    private val mAdapter by lazy {
        MainAdapter(this, mData)

    }

    @RequiresApi(Build.VERSION_CODES.O)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        lv.layoutManager = LinearLayoutManager(this)
        lv.addItemDecoration(DividerItemDecoration(this, DividerItemDecoration.VERTICAL))
        lv.adapter = mAdapter




        mAdapter.listener = object : MainAdapter.OnItemClickListener {
            override fun onItemClick(position: Int) {
                when (position) {
                    0 -> startActivity(Intent(this@MainActivity, QQStepActivity::class.java))
                    1 -> startActivity(Intent(this@MainActivity, ColorTrackActivity::class.java))
                    2 -> startActivity(Intent(this@MainActivity, ViewPagerActivity::class.java))
                    3 -> startActivity(Intent(this@MainActivity, RoundProgressActivity::class.java))
                    4 -> startActivity(Intent(this@MainActivity, CityLoadActivity::class.java))
                    5 -> startActivity(Intent(this@MainActivity, RatingBarActivity::class.java))
                    6 -> startActivity(Intent(this@MainActivity, LetterSideBarActivity::class.java))
//                    7->startActivity(Intent(this@MainActivity, BubbleView::class.java))
                }
            }

        }
    }





}
